package com.biggabrotha.test {
  import com.biggabrotha.GooglePictureProvider;

  import org.flexunit.Assert;

  public class GooglePictureProviderTest {

    private static var gpp:com.biggabrotha.GooglePictureProvider = new GooglePictureProvider();

    [BeforeClass]
    private static function bc():void {
      //this doesnt seem to be called 
    };

    [Ignore]
    public function testGooglePictureProvider():void {
      gpp.queryString = "abc"
      gpp.send()
    };

    [Ignore]
    public function createNewRandomQueryString() {
      var a:Array = [];
      for (var i:int = 0; i < 10000; i++) {
        a.push(gpp.createNewRandomQueryString())
      }
      for (i = 0; i < GooglePictureProvider.alphabet.length; i++) {
        var alphabetchar:String = GooglePictureProvider.alphabet.charAt(i);
        var t:int = a.indexOf(alphabetchar)
        Assert.assertTrue(t > -1)
      }
      for each (var char:String in a) {
        Assert.assertTrue(char.length > 1)
        var tm:int = GooglePictureProvider.alphabet.indexOf(char)
        Assert.assertTrue(tm > -1)
      }
      trace(a)
    };

    [Test]
    public function createRandomNumberInInterval() {
      var interval:Number = 1000
      var wrapthreshold:int = 200
      var wrap:int = 0;
      var s:String = ""
      for (var i:int = 0; i < 10000; i++) {
        if (wrap > wrapthreshold) {
          trace(s)
          s = ""
          wrap = 0
        }
        s += gpp.createRandomNumberInInterval(1000) + ";"
        wrap++;
      }
      trace(s)
    };
  }
}